/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tests;

import java.util.List;
import ws.ManagePOI;
import ws.ManagePOIService;
import ws.Poi;
import ws.Travel;
//import util.DBManagement;

/**
 *
 * @author chuda
 */
public class Tests {
    public static void main(String[] args) {


        try { // Call Web Service Operation
            ws.ManagePOIService service = new ws.ManagePOIService();
            ws.ManagePOI port = service.getManagePOIPort();
            // TODO initialize WS operation arguments here
            java.lang.String mobNumber = "23456";
            // TODO process result here
            java.util.List<ws.Order> result = port.getOrdersByMobNumber(mobNumber);
            ws.Order order = result.get(1);
            order.setTelNumber("123");
            System.out.println( port.makeOrder(order));
            System.out.println("Result = "+result);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }



        Poi orderpoi;
        try { // Call Web Service Operation
            ws.ManagePOIService service = new ws.ManagePOIService();
            ws.ManagePOI port = service.getManagePOIPort();
            // TODO process result here
            java.util.List<ws.Poi> result = port.getAllPOIs();
            System.out.println("Result = "+result);
            orderpoi = result.get(0);
            System.out.println(orderpoi.getId());
            //public Order(POI poi, String telNumber, int numPeople, String name)
            ws.Order order = new ws.Order(orderpoi,"234",2,"Chuda");
            
           System.out.println("result of order: "+port.makeOrder(order));
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }


       




//        try { // Call Web Service Operation
//            System.out.println("hello");
//            ManagePOIService service = new ManagePOIService();
//            ManagePOI port = service.getManagePOIPort();
//            // TODO initialize WS operation arguments here
//            String keyword = "coi";
//            // TODO process result here
//            List<ws.Poi> result = port.getPOIsByKW(keyword);
//            for(Poi poi: result){
//                if(poi instanceof Travel){
//                    Travel travel = (Travel) poi;
//                    System.out.println(travel.getCountry());
//                }
//
//            }
//            System.out.println(result.size());
//            System.out.println("Result = "+result);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            // TODO handle custom exceptions here
//        }

  





//        try { // Call Web Service Operation
//            ws.POImanagerService service = new ws.POImanagerService();
//            ws.POImanager port = service.getPOImanagerPort();
//            // TODO initialize WS operation arguments here
//            java.lang.String keyword = "";
//            // TODO process result here
//            ArrayList<POI> result = port.GetPoisByKeyWord("coi");
//            System.out.println("Result = "+result);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            // TODO handle custom exceptions here
//        }




//        DBManagement dbm = new DBManagement();
//        ArrayList<POI>pois = dbm.selectPOIByKeyWord("coi");
//        System.out.println(pois);
//        if(pois!=null)
//        for(POI poi:pois){
//            System.out.println(poi.getDescription());
//        }
//        else
//            System.out.println("null");
   }
}
